Analog to digital conversion employing the system clock of a microprocessor, the clock frequency varying with analog input

ABSTRACT

The present invention performs analog to digital conversion using the system clock of a microprocessor, the system clock being the clock which controls the rate of operation of the microprocessor. A varying analog signal is applied to the clock frequency control input of the microprocessor, thereby causing the clock frequency and the rate of operation of the microprocessor to vary in accordance with the varying analog signal. The clock is counted for a predetermined period of time. In the preferred embodiment this predetermined period of time is set by the 60 Hz AC power line. The counted contents at the end of this predetermined period of time is a digital representation of the varying analog signal. The microprocessor includes circuits for performing other operations at the rate set by the clock frequency. The other operations performed by the microprocessor must not be deleteriously affected by the varying rate of operation caused by the varying analog signal. In the preferred embodiment the varying analog signal is the output of a thermistor corresponding to the ambient temperature and the microprocessor includes additional control functions for using the digital representation of the analog signal for thermostatic control of a temperature modifying apparatus.

This application is a division of application Ser. No. 579,409 filed Feb. 13, 1984 now U.S. Pat. No. 4,531,064 which is a division of Ser. No. 350,522 now U.S. Pat. No. 4,469,274 filed Feb. 19, 1982 which is a division of U.S. Pat. No. 4,335,847 filed May 27, 1980.

TECHNICAL FIELD

This invention relates to programmable thermostats for controlling a heating and/or cooling system to maintain predetermined temperatures at times over a repetitive time cycle and more particularly to such a system in which the operator programs the thermostat by inputting a desired temperature and the system achieves that temperature at the programming time on a repetitive basis.

BACKGROUND ART

Most residential thermostats include means for entering a single set point and operate to control their associated heating and/or air conditioning system (hereinafter "furnace") to maintain the set point temperature. Substantial energy savings can be achieved if the set point is lowered during periods when the house is unoccupied or the occupants are sleeping and a form of "set back" thermostat employs a mechanical clock which allows the entry of two set points to be achieved at different periods on a repetitive time cycle.

My co-pending application, Ser. No. 778,376, now U.S. Pat. No. 4,206,872 entitled "Electronic Thermostat" discloses a system including a digital memory capable of storing a lengthy schedule of desired temperatures for times within a repetitive cycle. The memory is continually interrogated by a digital clock to output a signal representative of the desired temperature set point at the time and this temperature is compared to the measured building temperature to control the operation of the furnace. This system allows the provision of relatively complicated time/temperature programs to accommodate to the habits of the building's occupants.

My U.S. Pat. No. 4,172,555 discloses an improved form of multiple set-point electronic thermostat in which the system adaptively determines the rate of temperature change that occurs within the building during operation of the heating/cooling system and energizes the furnace a period of time before a programmed temperature in order to insure that the programmed temperature is attained within the building at the proper time.

These systems represent highly economical energy conserving alternatives to conventional residential thermostats but programming the systems is relatively complicated and may be confusing to a user. Also, an appreciable percentage of the manufacturing cost of these systems is dedicated to programming devices and displays that are required to simplify the programming.

The present invention is directed toward an electronic multiple set-point thermostat employing a low cost form of program entry which is easy to understand and use.

DISCLOSURE OF THE INVENTION

In contrast to previous programmable multiple set-point thermostats for which it was necessary for the operator to program each set-point change by entering the time of the change and the desired temperature at that time, the present invention provides a thermostat which is programmed by merely entering a desired temperature at the time that the temperature is desired to be attained. The operator can also control whether the temperature change is to be programmed for daily reoccurrence or only for weekly reoccurrence. The thermostat is thus programmed on a real time basis by the operator inputting desired temperatures at appropriate times. During the first day of operation a daily program is entered and over the alance of the week alternative programs that are to be operative once a week are entered. By way of example, the occupants may arise at 7:00 a.m. six days a week and want to sleep until 9:00 a.m. on Sunday. The desired temperature at rising is entered during the first day of operation at 7:00 a.m. On Sunday morning the operator can reprogram the device so that the normal daily program will be changed each Sunday.

This simplified programming is achieved by providing an internal clock which acts as a memory address and sequentially points to different memory sections. The desired set-point is read into memory at the section designated by the clock at the time of the setpoint entry and that desired set-point is read out of memory and used to control the thermostat each time the clock cycle returns to that memory section.

The present invention further contemplates an improvement in the adaptive thermostat disclosed in my U.S. Pat. No. 4,172,555. Rather than programming a particular night set-back temperature that is attained until a time determined on an adaptive basis when the furnace is turned on so that the morning wake-up temperature can be achieved at the proper time, the system simply turns off the furnace at the programmed evening time and restarts the furnace at a time adaptively determined to be sufficient to achieve the programmed temperature at wake-up time. No control is exercised over the minimum temperature achieved during the night other than by a safety switch which prevents the building temperature from going below a predetermined minimum, such as 45° F.

The program entry controls of the thermostats of the present invention simply comprise means for entering a desired temperature, either absolutely, or relative to some reference temperature; means for clearing the program; and means for switching between automatic control and a constant temperature. The elementary nature of the controls lowers the cost of the thermostat relative to prior art electronic thermostats and simplifies the programming operation to avoid confusion to the operator.

Another aspect of the present invention resides in the use of a temperature sensitive, variable frequency oscillator to generate an electrical signal representative of the ambient temperature and also to act as a clock source for a microcomputer implementing the thermostat eliminating the need for a separate clock oscillator. The system is normally powered from the alternating current power mains and a battery is provided for back-up during power failure. Upon power failure the frequency of the temperature sensitive oscillator is measured and the oscillator is then used as a time standard during the power failure to maintain the internal clock with a reasonable degree of precision.

BRIEF DESCRIPITON OF THE DRAWINGS

FIG. 1 is a perspective view of an operating panel of a preferred embodiment of my thermostat;

FIG. 2 is a schematic diagram illustrating the functional operation of a preferred microprocessor based embodiment of my thermostat, or, alternatively, a schematic diagram of an embodiment of the thermostat based on discrete subsystems; and

FIG. 3 is a similar schematic diagram of certain sections of my thermostat.

BEST MODE FOR CARRYING OUT THE INVENTION

A preferred embodiment of the invention is illustrated in FIGS. 1-3. The thermostat is packaged in a housing 10 illustrated in FIG. 1. The controls and displays for the thermostat are arrayed on the front panel of the case 10. A pivotable door 12 supported on a vertical hinge extending along one side of the front panel is normally closed and hides a set of input controls positioned on the right side of the front panel as it is viewed in FIG. 1 that are used less frequently than the controls positioned on the left side of the panel. The door 12 is shown in FIG. 1 in its open position in which the less frequently used controls are visible.

The visible controls and displays include an analog scale 14 associated with a pointer 16 that displays the atmospheric temperature at the thermostat. The pointer 16 may be positioned by a conventional measurement device such as a spiral bi-metal coil 18, illustrated in FIG. 2. Numerical indicia are associated with the scale 14 so that the actual temperature at the thermostat may be read as a function of the position of the pointer 16.

Normally accessible controls include a series of four lights such as light emitting diodes (LED'S) 20, 22, 24, 26 and 27. The legends "WARMER"; "COMFORTABLE"; "COOLER"; "SET BACK" and "MAXIMUM SET BACK" are associated with the five lights 20-27, respectively. An operator controlled push button 28, having the legend "CYCLE" imprinted in association, may be depressed by the operator to cause the LED'S 20-27 to cycle sequentially into their energized states at a rate of approximately one cycle per second. If the push button 28 is lifted while one of the LED'S is energized, the cycle will stop and that LED will remain energized. In this manner, the operator can select one of five cycles. As an alternative to the light and the CYCLE button a five-position switch could be employed.

The readily accessible controls further include a light emitting diode 32 with the associated legend "UNIT IN OPERATION".

Those controls which are normally hidden by the door 12 and are arrayed across the lower half of the front panel of the case 10 include a three-position switch 34 with the legends "LEARN"; "AUTO"; and "MANUAL" associated with its positions; a screwdriver adjustable shaft 36 with the legend "COMFORTABLE ADJUST" associated therewith; a two-position switch 40 with the legends "HEATING" and "COOLING" associated with its positions; a two-position "ON-OFF" switch 42; and a two-position "AUTO" -"FAN ON" switch 43.

The thermostat is connected to the associated ventilation equipment via four wires 44, 46, 48 and 50 which are intended to connect to the ventilation fan, furnace, air conditioner and common terminal of the power line, respectively. Other embodiments of the invention could be used with two lines to simply control operation of the furnace.

The manner in which the thermostat functions under control of the operator will now be explained without reference to the internal arrangement of the thermostat in the belief that this will render the subsequent description of the internal arrangement of the thermostat more readily understandable.

Assume that initial use of the device is in the winter, when furnace operation is desired. After wires 44-50 are properly connected, the switch 42 is first turned on to the ON position and switch 40 is turned to the HEATING position. Switch 34 is turned to the MANUAL position. Switch 43 is turned to the desired fan control mode. In the AUTO mode the fan is energized whenever the furnace or air conditioner is energized by the thermostat.

Next the push button 28 is depressed until the CYCLE light 22 associated with COMFORTABLE is energized.

Assuming that the room temperature is relatively low, i.e., below about 62° F., the furnace will be energized via line 44 and the light 32 will turn on. The temperature within the room associated with the thermostat will begin to increase until a predetermined temperature is attained, at which point the light 32 will go off. This is the COMFORTABLE or normal temperature then associated with the thermostat. It may be in a range from about 65° F. to 80° F. If the operator desires a different normal temperature the shaft 36 may be rotated to modify COMFORTABLE. By watching the light 32 and temperature indicator 16 the operator can determine the normal temperature and modify it using adjustment 36.

This COMFORTABLE temperature will be the usual daytime temperature when the building is occupied. In order to program the thermostat with a particular daily SET BACK cycle, the operator then waits until some change in the temperature is desired. For example, if the thermostat is installed in the afternoon the operator may wait until normal bedtime in the house when a substantially lower, night SET BACK operation is desired. Assuming the SET BACK is desired at 11:00 p.m., at that time the operator switches the switch 34 to the "LEARN" position and depresses the CYCLE button 28 until the either the SET BACK light 26 or the MAXIMUM SET BACK light 27 is energized. This action programs the thermostat to go into a SET BACK mode each night at 11:00 p.m.

In the MAXIMUM SETBACK mode the system will turn off the furnace at the SETBACK time and leave it off until it must be turned on in order to warm the building to attain the programmed wake-up temperature in the morning. In the SETBACK mode the minimum temperature will be approximately 10° below COMFORTABLE until the furnace must begin warming the building to attain the programmed wake-up temperature at its scheduled time. In either mode the system will determine the necessary start-up time adaptively by measuring the rate of temperature change within the building while the furnace is energized and calculating the necessary turn-on time in order to attain the next scheduled temperature. This adaptive mode cannot be employed until a wake-up temperature has been programmed so during the first night after it is programmed the minimum temperature will be 5° below COMFORTABLE.

Next assume that it is desired that the building be warmed up to slightly lower than COMFORTABLE temperature by 6:30 a.m. At 6:30 a.m. the operator presses the cycle button until the COOLER light 24 is energized. Thereafter a temperature approximately 2° less than COMFORTABLE will be programmed at 6:30 a.m. each morning until the program is altered. If SETBACK or MAXIMUM SETBACK is the previous program entry the thermostat will operate in the adaptive mode previously described.

Next assume that the operator desires that a temperature SETBACK occur at 9:00 a.m. At 9:00 a.m. the CYCLE button 28 is depressed until the SETBACK light 26 is energized. A typical daily cycle might further include attaining a temperature about 2° above COMFORTABLE at 6:00 p.m. This is achieved by energizing the light 20 at 6:00 p.m. through use of the CYCLE button 28.

Twenty-four hours after the first program entry was made in the LEARN mode the system automatically switches to a learning mode wherein program changes only alter the particular day of the week in which the change is made; i.e., a change made at Saturday noon will be operative each Saturday thereafter until the programming is altered. For example, assume that the daily schedule involves going to SET BACK temperature at 11:00 p.m. and on Friday night the occupants go to sleep at 12 midnight and accordingly want to alter the daily schedule for the weekend. At 10:00 p.m. or so on Friday night the occupant would depress the CYCLE button 28 until the presently desired temperature was attained, such as COMFORTABLE.

If the set point thus programmed is the same as the existing set point, no alteration will be made in the computer's program, but the action will initiate a mode in which existing memory entries will be erased as they are called up from memory and new entries which operate on a weekly basis only will be entered. These changes will not affect the other six days of the week. Thus when the normal 11:00 p.m. SET BACK program is called out it will be erased from the memory for that day of the week and will have no further effect on the operation of the thermostat.

At 12:00 p.m. the operator would then operate the CYCLE button until the system was in SET BACK while still in LEARN mode. This would permanently enter 12 midnight as the SET BACK time for that day in the week only. The 6:30 a.m. wake-up time would be automatically erased for that day of the week. Assuming the occupants sleep until 9:00 a.m. on Saturday, they would program a desired morning temperature, such as COOLER at 9:00 a.m. while the system was still in the LEARN mode and that would be entered for that day.

After all desired alternative daily schedules have been entered the operator returns switch 34 to the AUTO position.

The system can be set into the MANUAL mode, enabling the setting provided in the CYCLE switch, at any time, without in any way altering the memory. When the system is returned to the AUTO mode the programmed temperature cycle is resumed.

The normal adjust 36 may be modified at any time to increase or decrease the COMFORTABLE temperature and the COOLER and WARMER temperatures.

The electronic components of the thermostat are preferably implemented using a micro-computer, properly programmed to achieve the described functions. FIG. 2 is a schematic diagram which may be interpreted in terms of a discrete sub-system version of the thermostat and its connected components, or alternatively as a functional guide to the structure of a program for a micro-processor.

Referring to FIG. 2, the thermostat includes a digital random access memory generally indicated at 60 partitioned into seven sections denominated 60a, 60b, 60c, 60d, 60e, 60f and 60g. These may constitute separate sections of a single memory or separate memory modules. Each memory section stores the temperature program for one 24-hour period in the seven day, repetitive cycle of the thermostat.

A clock 62, powered in a manner which will subsequently be described, generates a digital signal, each one-half hour. These signals are provided to a modulus 48 counter 64 which generates a signal for the memory 60 representative of the one-half hour period within the day. Each time the mod 48 counter 64 overflows it provides a signal to a mod 7 counter 66 which generates one of seven output signals which acts as an address for one of the seven memory sections 60a-60g. The half hour clock 62 also feeds a mod 48 counter 70 which controls the condition of a flip-flop 72. The flip-flop is placed in an initial SET condition when the switch 42 first turns the system on and starts the clock. After 24 hours an overflow signal from the mod 48 counter 70 places the flip-flop 72 in a RESET condition. While in the SET condition the flip-flop 72 causes any changes in the cycle lights 20-27 to be recorded in the current half-hour memory locations within all seven of the memory sections 60a-60g. When the flip-flop 72 is reset after 24 hours, mode changes are only recorded in the single memory section addressed by the output of the mod 7 counter 66.

This operation is achieved by circuitry including an AND gate 74 conditioned by the set output of flip-flop 72 and by the output of an AND gate 76. The AND gate 76 is in turn conditioned by the LEARN output of switch 34 and a signal from a filter 78 which emits signals representative of changes in the cycle lights 20-27 which last for more than three seconds. This insures that the rapid cycling of the lights 20-27 which occurs when the operator presses the cycle button 28 will only modify the memory as a function of the last cycle position achieved.

Accordingly, when the mode is changed by virtue of depression of the CYCLE button 28 and the system is in LEARN, the gate 76 provides an output to the memory 60 and also to the AND gate 74. If the flip-flop 72 is in the SET condition, as it is during the first 24 hours of the LEARN cycle, a signal will be provided to a seven pulse generator 80. The pulses outputted by the generator 80 are provided to the mod 7 counter 66 to cause the day address of the memory to be cycled through seven states. The output from the AND gate 76 is sustained during this cycling and accordingly that output is recorded in the memory position pointed to by the one-half hour address output of the mod 48 counter 64 in each of the seven memory sections 60a-60g as they are sequentially addressed in rapid order by the output of the mod 7 counter 66 under the influence of the generator 80.

Alternatively, if the flip-flop 72 is in the RESET condition, as it is after the first 24 hours of the LEARN cycle, the seven pulse generator 80 is not energized and the output of the gate 76 is only recorded in the appropriate one-half hour time slot of the single memory section being pointed to by the output of the mod 7 counter 66. If the system is not in the LEARN mode but is in either the AUTO or MANUAL mode, the outputs of the filter 78 representing changes in the CYCLE mode are not recorded in memory.

When the CYCLE button 28 is depressed, a pulse generator 82 is energized and pulses at a one cycle per second rate are provided to a mod 5 counter 84. The counter provides signals to a one out of five latching decoder 86 that energizes one of the LED'S 20-27. A fifth light 88 is illustrated in phantom and represents an alternative arrangement wherein the system could exercise control over some auxilliary device, other than the furnace/air conditioning unit. For example, the system could be used to turn on lights or an appliance within the house at a desired time through provision of an auxilliary control device such as 90 which could be controlled by the system.

When the system is in the AUTO mode the CYCLE lights 20-27 are energized as a function of the outputs from the memory through an AND gate 92. The gate 92 receives otuputs from the memory which are determined by the composite address signal generated by the mod 7 counter 66 and the mod 48 counter 64. The gate 92 is also conditioned by a MANUAL signal from switch 34 and a JOG signal, the source of which will be subsequently described. The output of the gate 92 is provided to the decoder 86 through an OR gate 94, where it is summed with the output of an AND gate 96, to control the condition of the lights 20-27.

The AND gate 96 receives the output of the mod 5 counter 84 and is conditioned by a signal from the push button 28 indicating that it is depressed. Thus the decoder 86 and the lights 20, 22, 24, 26 and 27 are conditioned by the output of the memory when the system is in the AUTO mode, and the cycle button is not being depressed, and by the output of the counter 84, controlled by the CYCLE button 28, when the system is in either the LEARN or the MANUAL mode.

The output of the OR gate 94 is provided to a comparator 98. The comparator also receives the output of a temperature sensor 100 and provides a two-state output signal adapted to control the state of energization of the furnace/air conditioner, to bring the sensed temperature into accord with the temperature called for by the thermostat.

The temperature sensor 100 provides an output that is trimmed by the COMFORTABLE adjust potentiometer 36. Its output is thus in effect a composite signal which is a function of both the sensed temperature and the position of the COMFORTABLE adjust potentiometer.

The output of the comparator 98 is provided to the furnace 102 and/or air conditioner 103 through the heat/cool switch 40 and the bi-metal switch 18. The bimetal switch 18 has three positions. It is usually in the NORMAL position in which the output of the comparator 98 controls the furnace 102. The switch 18 goes to an OFF position when the temperature in the environment of the thermostat exceeds a maximum temperature such as 95° F. and goes to an ON position when the temperature in the environment of the thermostat goes below a minimum temperature; i.e., 45° F. This relationship is reversed when the system is in the cooling mode and the controlled device is an air conditioner.

An adaptive control subsystem 104 is energized when the system is in AUTO and the output of memory constitutes the SETBACK mode. This condition is sensed by an AND gate 108. The adaptive control 104 also receives the output of the temperature sensor 100 and the comparator 98.

When the system enters the adaptive mode the control 104 provides a start signal to a 7 bit binary down counter 200. The start signal loads binary ONES into the three most significant positions of this 7 bit counter, effectively presetting it with a count of 48. The presence of a ONE in the most significant position of a counter 7 constitutes a signal termed JOG which is provided to one conditioning input of an AND gate 202. The other input to the AND gate 202 is from a high speed clock that is continually operative. The output of the AND gate 202 is provided to the input of the 7 bit down counter 200 and begins to count it down at the output rate of the high speed clock. The pulses from the AND gate 202 are also provided to the MOD 48 counter 64. After 48 pulses have been provided to the counter 200, as well as to the counter 64, the contents of the counter 200 will constitute zeros in all 7 positions and the MOD 48 counter 64 will have returned to the value that existed before the beginning of the JOG cycle. The existence of all zeros in the counter 200 causes termination of the JOG signal.

The JOG signal also conditions an AND gate 204 which receives its other conditioning input from the output of the memory 60 and provides an output to a first change detector 206. The detector examines the output of the memory during the JOG cycle and upon the occurrence of the first change, representing the next temperature programmed in the memory, provides an output signal to a next temperature latch 122 which also receives the output from the memory 60 and stores the next output value. The output signal from the first change detector 206 also conditions an AND gate 208 that acts to load the contents of the down counter 200, at the instant that the first temperature change is detected, into the adaptive control 104. This signal is a function of the time interval between the present time and the time when the next program temperature is scheduled to occur.

The output of the next temperature latch is provided to an AND gate 210 which is also conditioned by an output from the adaptive control 104 termed START NEXT TEMP. This signal occurs at the time calculated by the adaptive control signal for starting of the furnace in order to attain the next scheduled temperature at its programmed time. The signal from the AND gate 210 is provided to the OR gate 124 and through the OR gate to the latched decoder 86.

The adaptive control monitors the furnace ON signal when the system is not in SETBACK to determine and continually up-date the duty cycle of the furnace. The duty cycle is a function of the rate of heat exchange between the building being heated and the exterior environment at any time and is thus also proportional to the rate of temperature increase in the building while the furnace is on.

The adaptive control 104 then calculates the time at which the furnace must be turned on to attain the next programmed temperature at its programmed time based on the equation ##EQU1## where T_(ex) equals the duty cycle and ΔT equals future program temperature minus present temperature.

The constant K, in units of degrees/hour, is determined adaptively by a comparison of the time at which the furnace actually reaches the next scheduled temperature and the time at which it is programmed to reach that next scheduled temperature. Each time the system ends the adaptive mode K is increased by one increment, preferably one degree per hour, when the programmed temperature is attained before its scheduled time and is decreased by one increment when the programmed temperature is not yet attained at the scheduled time.

Accordingly, after the JOG cycle the temperature contained in the next temperature latch 122 is provided to the comparator 98 through the OR gates 124 and 94. However, the adaptive control 104 generates an OFF signal which is provided to the comparator 98 and prevents furnace actuation until the adaptive control removes the OFF signal at a time before the next program temperature calculated to allow the furnace to attain the next programmed temperature within the building at its scheduled time. The detailed manner of operation of the adaptive control 104 is disclosed in my U.S. Pat. No. 4,172,555.

The memory is thus programmed by placing the switch 42 in the ON position and placing the switch 34 in the LEARN position. Thereafter, the mode called for by the LED'S 20-27 is programmed into the memory. During the first 24 hours of operation the programming is recorded into all of the seven day sections of the memory. After the first 24 hours of operation changes made in the operating mode while the switch 34 is still in a LEARN position are only recorded in the memory section for that day. After the operator is satisfied with the recorded cycle the switch 34 may be turned to the AUTO position. At any time the switch may be turned to the MANUAL position and the recorded control program will be ignored and the mode called for by the condition of the LED'S 20-27 will be followed.

The switch 34 can be returned to the LEARN position to modify any single day temperature record at the option of the operator.

When the switch 42 is turned to the OFF position the program is cleared providing a clean slate for reprogramming.

The detailed construction of the temperature sensor 100 and the circuitry feeding the clock 62 are illustrated in FIG. 3. The temperature is preferably sensed by a thermistor 130 although other temperature sensitive elements such as a temperature sensitive diode could be used for the function. The thermistor 130 is shunted by a capacitor 132, as well as by the comfortable adjust potentiometer 36. These three units form the RC circuit for an oscillator 134, operative to generate an output signal having a frequency which is a function of both the temperature sensed by the thermistor 130 and the setting of the potentiometer 36.

The oscillator 134 preferably forms the internal oscillator of a microprocessor and the output signals from the oscillator, on line 136, generate the microprocessor internal clock signals, so that the clock cycle of the microprocessor is controlled by the output of the oscillator 134. The variations in the rate of operation of the microprocessor which result from this design do not deleteriously affect the performance of this thermostat and the arrangement eliminates the need for separate oscillators for generating a temperature variable signal and for serving as the internal clock of the microprocessor.

The temperature sensitive output of the oscillator on line 136 is provided to a counter 138 which, like the other digital units of the thermostat, is preferably implemented by registers within the microprocessor.

The 60 cycle power supply is applied to a zero crossing detector 140 which generates a 60 Hz square wave. This signal resets counter 138 resets the overflow flip-flop 144 and causes the contents of counter 138 to be transfered to the temperature latch 142. The frequency of the oscillator will be substantially higher than 60 cycles per second, preferably in the kilohertz range, so that the number of pulses generated on line 136 during 1/60th of a second will be relatively large and will vary significantly as a function of variations in the ambient temperature on the thermistor 130. The contents of the temperature latch 142 will be modified to conform with the count read-out of the counter 138 each 1/60th of a second. The contents of the temperature latch 142 constitute the output of the temperature sensor 100 which is provided to the comparator 98 illustrated in FIG. 2.

In the event of failure of the 60 cycle power supply no output signals will be provided by the zero crossing detector 140 and the counter 138 will quickly overflow. The overflow signal sets a flip-flop 144 which is reset by the output of the zero crossing detector when the 60 cycle power supply resumes. The set output of the flip-flop 144 switches on a battery power supply 146 that powers the oscillator 134 as well as the other circuitry of the microprocessor. The set output of the flip-flop 144 also energizes a comparator 148 which receives the parallel output of the temperature latch 142 and the parallel output of the counter 138. When the count within the counter reaches the number stored in the temperature latch the comparator provides a reset output to the counter via OR gate 150, returning it to zero. These reset outputs thus occur at a 1/60th of a second rate as long as the output of the oscillator 134 remains constant. During the period of less than a few minutes characteristic of a typical power outage, the ambient temperature on the thermistor 130 should not vary so greatly as to make a significant change in the frequency of the oscillator 134.

While power is provided by the 60 cycle mains the outputs of the zero crossing detector 140 are provided to the clock 62, illustrated in FIGS. 2 and 3, through the gate 150. When the 60 cycle power fails and the outputs from the zero crossing detector 140 terminate, the resetting outputs from the comparator 148 are fed to the clock 62 through the OR gate 150, acting as a substitute for the usual clock pulses.

This arrangement preserves the internal clock of the thermostat in substantial synchronism with real time despite power failures of up to a few hours or even days, depending upon the rate of heat transferred between the building and the exterior during that period. This eliminates the need to reprogram the thermostat following power outages of a moderate duration. Although the internal clock may drift by a few seconds or even a few minutes during one of these power outages, because of the variation in the output frequency of the oscillator 134 as a result of temperature changes during the outage, these will not substantially affect the performance of the thermostat since it is usually not critical whether a temperature is attained at a particular time with a high degree of precision. 

Having thus described my invention, I claim:
 1. In an electronic system operative to generate a digital signal representative of a varying analog signal, and including a microprocessor operative to perform the analog to digtial conversion, the microprocessor including an oscillator circuit which controls the rate of operation of the microprocessor, means for connecting the varying analog signal to the oscillator input of the microprocessor so that the microprocessor operates at a rate dependent upon the varying analog signal, a counter operative to receive the outputs of the oscillator, and a constant frequency oscillator connected to the counter to clear the counter at regular intervals, the outputs of the counter at clearing representing digital signals representative of the varying analog signal.
 2. The electronic system as claimed in claim 1, wherein the microprocessor further includes control means for performing a control function at the rate controlled by the oscillator circuit, the control function of a type not deleteriously affected by the variation in the rate of operation of the microprocessor caused by the varying analog signal.
 3. The electronic system as claimed in claim 2, wherein said control means performs the control function employing the digital signals representative of the varying analog signal.
 4. The electronic system as claimed in claim 3, wherein the varying analog signal corresponds to the ambient temperature and the control means performs the control function of thermostatic control of a temperature modifying apparatus.
 5. The electronic system as defined in claim 1, wherein said counter operative to receive the outputs of the oscillator is embodied by a memory register within said microprocessor having data therein which is incremented through program operation of said microprocessor at said rate of operation of said microprocessor which is dependent upon said varying analog signal.
 6. The elctronic system as claimed in claim 1, wherein said constant frequency oscillator includes a zero-crossing detector connected to a 60 hertz power supply.
 7. In a microprocessor system including a microprocessor with a clock oscillator for generating a clock siganl controlling the rate of operation of the microprocessor, the clock oscillator including a time constant input for determining the frequency of the clock signal, the improvement comprising:an analog signal generating means connected to said time constant input for applying a varying analog signal to the time constant input controlling the frequency of the clock signal of the clock oscillator and thereby the rate of operation of the microprocessor; a digital counter means for counting the clock signal of the oscillator; a digital latch means for storing a digital count; a constant frequency oscillator, having a frequency much less than said clock oscillator, connected to said digital counter means for periodically loading said digital latch means from said digital counter means and clearing said digital counter means, the digital count stored in said digital latch means being a digital representation of said analog signal; and a digital signal utilization means for performing a control function based on said digital count stored in said digital latch means, wherein said digital counter means, said digital latch means and said digital signal utilization means are formed as part of the microprocessor, said control function performed by said digital signal utilization means of a type not deleteriously affected by the variation in rate of operation of the microprocessor.
 8. A microprocessor system as claimed in claim 7, wherein:said analog signal generating means generates said varying analog signal in accordance with the ambient temperature; and said control function of said digital signal utilization means is thermostatic control of a temperature modifying apparatus.
 9. A microprocessor system as claimed in claim 7, wherein:said digital counter means and said digital latch means are embodied by a memory register within said microprocessor having data therein which is incremented through program operation of said microprocessor at said rate of operation of said microprocessor which is dependent upon said varying analog signal; and said constant frequency oscillator includes a zero-crossing detector connected to a 60 hertz power supply. 